package com.example.text;


import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.text.Adapter.List_viewAdapter;

import java.util.ArrayList;
import java.util.List;

public class Fragment_index extends Fragment {
    private ListView listView;
   private View view;
    private List<mode_list> lists;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
         view= inflater.inflate(R.layout.fragment_index, container, false);
        initview();
        initfunction();
        return view;
    }

    private void initview() {
        listView=view.findViewById(R.id.list_view);
    }
    private void initfunction() {
        lists=new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            lists.add(new mode_list(R.mipmap.ic_launcher_round,"标题"+i,"内容"+i));
        }
        List_viewAdapter list_viewAdapter=new List_viewAdapter(lists,getContext());
        listView.setAdapter(list_viewAdapter);

    }
}
